package com.dianshang.controller.system;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dianshang.entity.Result;
import com.dianshang.pojo.system.Role;
import com.dianshang.service.system.RoleService;
import com.dianshang.service.system.AdminService;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/role")
public class RoleController {

    @Reference
    private RoleService roleService;

    @Reference
    private AdminService adminService;

    /**
     * 查询所有角色
     */
    @GetMapping("/findRole")
    public List<Role> findRole(){
        return roleService.findRole();
    }

    /**
     * 添加用户与角色
     */
    @PostMapping("/insert")
    public Result insert(@RequestBody Map<String,Object> formData){
        adminService.insert(formData);
        return new Result(0,"添加成功");
    }

}